//
//  ComplexChooseViewController.m
//  DebugDemo
//
//  Created by XFB on 2019/6/12.
//  Copyright © 2019 ZhouCheng. All rights reserved.
//

#import "ComplexChooseViewController.h"
#import "ProblemModel.h"
#import "ComplexMultiSelectViewController.h"
#import "GMBubbleView.h"

@interface ComplexChooseViewController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, weak) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArray;

@end

@implementation ComplexChooseViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setupBasicSet];
}

- (void)setupBasicSet
{
    self.view.backgroundColor = UIColorFromRGB(0x1abc9c);
    
    GMBubbleView *bubbleView = [[GMBubbleView alloc] init];
    bubbleView.frame = CGRectMake(30, 200, ScreenW-60, 300);
    [self.view addSubview:bubbleView];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    ComplexMultiSelectViewController *vc = [[ComplexMultiSelectViewController alloc] init];
    vc.problemArray = self.dataArray;
    [self.navigationController pushViewController:vc animated:YES];
}

- (NSMutableArray *)dataArray
{
    if (_dataArray == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Problem.plist" ofType:nil];
        NSArray *plistArray = [NSArray arrayWithContentsOfFile:plistPath];
        NSArray *modelArray = [ProblemModel mj_objectArrayWithKeyValuesArray:plistArray];
        NSMutableArray *mutableArray = @[].mutableCopy;
        for (ProblemModel *problemM in modelArray) {
            problemM.isDataSelected = NO;
            [mutableArray addObject:problemM];
        }
        _dataArray = [mutableArray mutableCopy];
    }
    return _dataArray;
}

@end
